home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Softshoe / Lisa's Mac Parts / Views / Canvas Loops / CanvasRowLoop.h < prev    next >
Text File  |  2000-06-23  |  968b  |  41 lines

  1. // CanvasRowLoop.h
  2.  
  3. #ifndef CanvasRowLoop_h
  4. #define CanvasRowLoop_h
  5.  
  6. #ifndef CanvasMaintainer_h
  7. #include "CanvasMaintainer.h"
  8. #endif
  9. #ifndef Canvas_h
  10. #include "Canvas.h"
  11. #endif
  12.  
  13. /*
  14.     This object can't screen out invisible rows, because it doesn't
  15.     know the row heights, and because you may want to do some work
  16.     on invisible rows, like keeping other variables in sync.
  17. */
  18.  
  19. class CanvasRowLoop
  20.   {
  21.     private:
  22.         const Canvas& parent;
  23.         Range32 row;
  24.         Canvas canvas;
  25.         CanvasMaintainer canvasMaintainer;
  26.         
  27.     public:
  28.         CanvasRowLoop( const Canvas&, Range32 firstRow );
  29.         
  30.         bool Finished() const                                { return row.Start() >= parent.OffScreen().bottom; }
  31.         bool Unfinished() const                                { return row.Start() < parent.OffScreen().bottom; }
  32.         
  33.         void NextRow( uint32 height );
  34.         void Remainder()                                        { NextRow( maxint32 - row.End() ); }
  35.         
  36.         const Canvas *operator->() const                    { return &canvas; }
  37.         const Canvas& operator*() const                    { return canvas; }
  38.   };
  39.  
  40. #endif
  41.